# 用于获取API入参的工具类


def get_api_input(api_name, *args):
    if api_name == "get_legal_document":
        return get_legalDoc_input(args[0])
    if api_name == "get_legal_abstract":
        return get_legal_abstract_input(args[0])
    if api_name == "get_court_info":
        return get_courtInfo_input(args[0])
    if api_name == "get_court_code":
        return get_courtRepresentative_input(args[0])
    if api_name == "get_lawfirm_info":
        return get_lawfirmInfo_input(args[0])
    if api_name == 'get_address_info':
        return get_address_info_input(args[0])
    if api_name == 'get_lawfirm_log':
        return get_lawfirm_log_input(args[0])
    if api_name == 'get_address_code':
        return get_address_code_input(args[0], args[1], args[2])
    if api_name == 'get_company_info':
        return get_company_info_input(args[0])
    if api_name == 'get_company_register_name':
        return get_company_register_name_input(args[0])
    if api_name == 'get_company_register':
        return get_company_register_input(args[0])
    if api_name == 'get_legal_document_list':
        return get_legal_document_list_input(args[0])


def get_legal_document_list_input(company_name):
    api_input = {
        "query_conds": {
            "关联公司": company_name
        },
        "need_fields": ["关联公司", "标题", "案号", "文书类型", "原告", "被告", "原告律师事务所", "被告律师事务所",
                        "案由", "涉案金额", "判决结果", "日期", "文件名"]
    }
    return api_input


def get_legal_abstract_input(case_num):
    api_input = {
        "query_conds": {
            "案号": case_num
        },
        "need_fields": ["文件名", "案号", "文本摘要"]
    }
    return api_input


def get_company_register_input(company_name):
    api_input = {
        "query_conds": {
            "公司名称": company_name
        },
        "need_fields": ["公司名称", "登记状态", "统一社会信用代码", "法定代表人", "注册资本", "成立日期", "企业地址",
                        "联系电话", "联系邮箱", "注册号"
            , "组织机构代码", "参保人数", "行业一级", "行业二级", "行业三级", "曾用名", "企业简介", "经营范围"]
    }
    return api_input


def get_company_register_name_input(credit_code):
    api_input = {
        "query_conds": {
            "统一社会信用代码": credit_code
        },
        "need_fields": []
    }
    return api_input


def get_company_info_input(company_name):
    api_input = {
        "query_conds": {
            "公司名称": company_name
        },
        "need_fields": ["公司名称", "公司简称", "英文名称", "关联证券", "公司代码", "曾用简称", "所属市场", "所属行业",
                        "成立日期", "上市日期",
                        "法人代表", "总经理", "董秘", "邮政编码", "注册地址", "办公地址", "联系电话", "传真",
                        "官方网址", "电子邮箱", "入选指数",
                        "主营业务", "经营范围", "每股面值", "首发价格", "首发募资净额", "首发主承销商"]
    }
    return api_input


# 浙江省丽水市景宁畲族自治县
def get_address_code_input(province, city, area):
    api_input = {
        "query_conds": {
            "省份": province,
            "城市": city,
            "区县": area
        },
        "need_fields": ["省份", "城市", "区县", "城市区划代码", "区县区划代码"]
    }
    return api_input


def get_lawfirm_log_input(lawfirm_name):
    api_input = {
        "query_conds": {
            "律师事务所名称": lawfirm_name
        },
        "need_fields": ["律师事务所名称", "业务量排名", "服务已上市公司", "报告期间所服务上市公司违规事件",
                        "报告期所服务上市公司接受立案调查"]
    }
    return api_input


def get_address_info_input(address):
    api_input = {
        "query_conds": {
            "地址": address
        },
        "need_fields": ["地址", "省份", "城市", "区县"]
    }
    return api_input


def get_lawfirmInfo_input(lawfirm_name):
    api_input = {
        "query_conds": {
            "律师事务所名称": lawfirm_name
        },
        "need_fields": ["律师事务所名称", "律师事务所唯一编码", "律师事务所负责人", "事务所注册资本", "事务所成立日期",
                        "律师事务所地址", "通讯电话", "通讯邮箱", "律所登记机关"]
    }
    return api_input


def get_courtRepresentative_input(court_representative):
    api_input = {
        "query_conds": {
            "法院代字": court_representative
        },
        "need_fields": ["法院名称", "行政级别", "法院级别", "法院代字", "区划代码", "级别"]
    }
    return api_input


def get_legalDoc_input(case_num):
    api_input = {
        "query_conds": {
            "案号": case_num
        },
        "need_fields": ["关联公司", "标题", "案号", "文书类型", "原告", "被告", "原告律师事务所", "被告律师事务所",
                        "案由", "涉案金额", "判决结果", "日期", "文件名"]
    }
    return api_input


def get_courtInfo_input(court_name):
    api_input = {
        "query_conds": {
            "法院名称": court_name
        },
        "need_fields": ["法院名称", "法院负责人", "成立日期", "法院地址", "法院联系电话", "法院官网"]
    }
    return api_input
